package solver

type Strategy func() bool

func (g *Grid) prepareStrategies() {
	g.strategies = []Strategy{
		g.LastOne,
		g.HiddenSingleInBoxes,
		g.HiddenSingleInRows,
		g.HiddenSingleInCols,
		g.NakedSingle,
		g.Pointing,
		g.Claiming,
		g.HiddenPair,
		g.NakedPair,
		g.HiddenTriple,
		g.NakedTriple,
		g.HiddenQuandruple,
		g.NakedQuadruple,
		g.XWing,
		g.Swordfish,
		g.Jellyfish,
	}

}

func (g *Grid) Solve() {
	g.prepareStrategies()

	used := false

	for {
		for _, strategy := range g.strategies {
			used = strategy()
			if used {
				//fmt.Println(g.strategyNames[i])
				break
			}
		}

		if !used {
			break
		}
		used = false
	}
}
